-- This is a sample file that will create a user 'secure' with full permissions to database 'openemr'
-- It also revokes that "ALL privileges" for user 'openemr' and grants permissions to each table individual except for
-- users_secure.  Running this full script repeatedly will fail as granting an "existing" permission or "revoking" a non-existent permission fails

-- Create a new user with full permissions
	create user 'secure'@'localhost' identified by 'securepassword';
	GRANT ALL on openemr.* to 'secure'@'localhost';

-- Revoke the default openemr user permissions of "all"
	revoke all on openemr.* FROM 'openemr'@'localhost';	

-- Grant ALL for each table individually
	GRANT ALL ON openemr.addresses to 'openemr'@'localhost';
	GRANT ALL ON openemr.amc_misc_data to 'openemr'@'localhost';
	GRANT ALL ON openemr.ar_activity to 'openemr'@'localhost';
	GRANT ALL ON openemr.ar_session to 'openemr'@'localhost';
	GRANT ALL ON openemr.array to 'openemr'@'localhost';
	GRANT ALL ON openemr.audit_details to 'openemr'@'localhost';
	GRANT ALL ON openemr.audit_master to 'openemr'@'localhost';
	GRANT ALL ON openemr.automatic_notification to 'openemr'@'localhost';
	GRANT ALL ON openemr.background_services to 'openemr'@'localhost';
	GRANT ALL ON openemr.batchcom to 'openemr'@'localhost';
	GRANT ALL ON openemr.billing to 'openemr'@'localhost';
	GRANT ALL ON openemr.categories to 'openemr'@'localhost';
	GRANT ALL ON openemr.categories_seq to 'openemr'@'localhost';
	GRANT ALL ON openemr.categories_to_documents to 'openemr'@'localhost';
	GRANT ALL ON openemr.chart_tracker to 'openemr'@'localhost';
	GRANT ALL ON openemr.claims to 'openemr'@'localhost';
	GRANT ALL ON openemr.clinical_plans to 'openemr'@'localhost';
	GRANT ALL ON openemr.clinical_plans_rules to 'openemr'@'localhost';
	GRANT ALL ON openemr.clinical_rules to 'openemr'@'localhost';
	GRANT ALL ON openemr.code_types to 'openemr'@'localhost';
	GRANT ALL ON openemr.codes to 'openemr'@'localhost';
	GRANT ALL ON openemr.config to 'openemr'@'localhost';
	GRANT ALL ON openemr.config_seq to 'openemr'@'localhost';
	GRANT ALL ON openemr.customlists to 'openemr'@'localhost';
	GRANT ALL ON openemr.dated_reminders to 'openemr'@'localhost';
	GRANT ALL ON openemr.dated_reminders_link to 'openemr'@'localhost';
	GRANT ALL ON openemr.direct_message_log to 'openemr'@'localhost';
	GRANT ALL ON openemr.documents to 'openemr'@'localhost';
	GRANT ALL ON openemr.documents_legal_categories to 'openemr'@'localhost';
	GRANT ALL ON openemr.documents_legal_detail to 'openemr'@'localhost';
	GRANT ALL ON openemr.documents_legal_master to 'openemr'@'localhost';
	GRANT ALL ON openemr.drug_inventory to 'openemr'@'localhost';
	GRANT ALL ON openemr.drug_sales to 'openemr'@'localhost';
	GRANT ALL ON openemr.drug_templates to 'openemr'@'localhost';
	GRANT ALL ON openemr.drugs to 'openemr'@'localhost';
	GRANT ALL ON openemr.eligibility_response to 'openemr'@'localhost';
	GRANT ALL ON openemr.eligibility_verification to 'openemr'@'localhost';
	GRANT ALL ON openemr.employer_data to 'openemr'@'localhost';
	GRANT ALL ON openemr.enc_category_map to 'openemr'@'localhost';
	GRANT ALL ON openemr.extended_log to 'openemr'@'localhost';
	GRANT ALL ON openemr.facility to 'openemr'@'localhost';
	GRANT ALL ON openemr.facility_user_ids to 'openemr'@'localhost';
	GRANT ALL ON openemr.fee_sheet_options to 'openemr'@'localhost';
	GRANT ALL ON openemr.form_dictation to 'openemr'@'localhost';
	GRANT ALL ON openemr.form_encounter to 'openemr'@'localhost';
	GRANT ALL ON openemr.form_misc_billing_options to 'openemr'@'localhost';
	GRANT ALL ON openemr.form_reviewofs to 'openemr'@'localhost';
	GRANT ALL ON openemr.form_ros to 'openemr'@'localhost';
	GRANT ALL ON openemr.form_soap to 'openemr'@'localhost';
	GRANT ALL ON openemr.form_vitals to 'openemr'@'localhost';
	GRANT ALL ON openemr.forms to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_acl to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_acl_sections to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_acl_seq to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aco to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aco_map to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aco_sections to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aco_sections_seq to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aco_seq to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aro to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aro_groups to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aro_groups_id_seq to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aro_groups_map to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aro_map to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aro_sections to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aro_sections_seq to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_aro_seq to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_axo to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_axo_groups to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_axo_groups_map to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_axo_map to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_axo_sections to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_groups_aro_map to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_groups_axo_map to 'openemr'@'localhost';
	GRANT ALL ON openemr.gacl_phpgacl to 'openemr'@'localhost';
	GRANT ALL ON openemr.geo_country_reference to 'openemr'@'localhost';
	GRANT ALL ON openemr.geo_zone_reference to 'openemr'@'localhost';
	GRANT ALL ON openemr.globals to 'openemr'@'localhost';
	GRANT ALL ON openemr.gprelations to 'openemr'@'localhost';
	GRANT ALL ON openemr.groups to 'openemr'@'localhost';
	GRANT ALL ON openemr.history_data to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd10_dx_order_code to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd10_gem_dx_10_9 to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd10_gem_dx_9_10 to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd10_gem_pcs_10_9 to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd10_gem_pcs_9_10 to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd10_pcs_order_code to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd10_reimbr_dx_9_10 to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd10_reimbr_pcs_9_10 to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd9_dx_code to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd9_dx_long_code to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd9_sg_code to 'openemr'@'localhost';
	GRANT ALL ON openemr.icd9_sg_long_code to 'openemr'@'localhost';
	GRANT ALL ON openemr.immunizations to 'openemr'@'localhost';
	GRANT ALL ON openemr.insurance_companies to 'openemr'@'localhost';
	GRANT ALL ON openemr.insurance_data to 'openemr'@'localhost';
	GRANT ALL ON openemr.insurance_numbers to 'openemr'@'localhost';
	GRANT ALL ON openemr.issue_encounter to 'openemr'@'localhost';
	GRANT ALL ON openemr.issue_types to 'openemr'@'localhost';
	GRANT ALL ON openemr.lang_constants to 'openemr'@'localhost';
	GRANT ALL ON openemr.lang_custom to 'openemr'@'localhost';
	GRANT ALL ON openemr.lang_definitions to 'openemr'@'localhost';
	GRANT ALL ON openemr.lang_languages to 'openemr'@'localhost';
	GRANT ALL ON openemr.layout_options to 'openemr'@'localhost';
	GRANT ALL ON openemr.lbf_data to 'openemr'@'localhost';
	GRANT ALL ON openemr.list_options to 'openemr'@'localhost';
	GRANT ALL ON openemr.lists to 'openemr'@'localhost';
	GRANT ALL ON openemr.lists_touch to 'openemr'@'localhost';
	GRANT ALL ON openemr.log to 'openemr'@'localhost';
	GRANT ALL ON openemr.notes to 'openemr'@'localhost';
	GRANT ALL ON openemr.notification_log to 'openemr'@'localhost';
	GRANT ALL ON openemr.notification_settings to 'openemr'@'localhost';
	GRANT ALL ON openemr.onotes to 'openemr'@'localhost';
	GRANT ALL ON openemr.openemr_module_vars to 'openemr'@'localhost';
	GRANT ALL ON openemr.openemr_modules to 'openemr'@'localhost';
	GRANT ALL ON openemr.openemr_postcalendar_categories to 'openemr'@'localhost';
	GRANT ALL ON openemr.openemr_postcalendar_events to 'openemr'@'localhost';
	GRANT ALL ON openemr.openemr_postcalendar_limits to 'openemr'@'localhost';
	GRANT ALL ON openemr.openemr_postcalendar_topics to 'openemr'@'localhost';
	GRANT ALL ON openemr.openemr_session_info to 'openemr'@'localhost';
	GRANT ALL ON openemr.patient_access_offsite to 'openemr'@'localhost';
	GRANT ALL ON openemr.patient_access_onsite to 'openemr'@'localhost';
	GRANT ALL ON openemr.patient_data to 'openemr'@'localhost';
	GRANT ALL ON openemr.patient_reminders to 'openemr'@'localhost';
	GRANT ALL ON openemr.payment_gateway_details to 'openemr'@'localhost';
	GRANT ALL ON openemr.payments to 'openemr'@'localhost';
	GRANT ALL ON openemr.pharmacies to 'openemr'@'localhost';
	GRANT ALL ON openemr.phone_numbers to 'openemr'@'localhost';
	GRANT ALL ON openemr.pma_bookmark to 'openemr'@'localhost';
	GRANT ALL ON openemr.pma_column_info to 'openemr'@'localhost';
	GRANT ALL ON openemr.pma_history to 'openemr'@'localhost';
	GRANT ALL ON openemr.pma_pdf_pages to 'openemr'@'localhost';
	GRANT ALL ON openemr.pma_relation to 'openemr'@'localhost';
	GRANT ALL ON openemr.pma_table_coords to 'openemr'@'localhost';
	GRANT ALL ON openemr.pma_table_info to 'openemr'@'localhost';
	GRANT ALL ON openemr.pnotes to 'openemr'@'localhost';
	GRANT ALL ON openemr.prescriptions to 'openemr'@'localhost';
	GRANT ALL ON openemr.prices to 'openemr'@'localhost';
	GRANT ALL ON openemr.procedure_answers to 'openemr'@'localhost';
	GRANT ALL ON openemr.procedure_order to 'openemr'@'localhost';
	GRANT ALL ON openemr.procedure_order_code to 'openemr'@'localhost';
	GRANT ALL ON openemr.procedure_providers to 'openemr'@'localhost';
	GRANT ALL ON openemr.procedure_questions to 'openemr'@'localhost';
	GRANT ALL ON openemr.procedure_report to 'openemr'@'localhost';
	GRANT ALL ON openemr.procedure_result to 'openemr'@'localhost';
	GRANT ALL ON openemr.procedure_type to 'openemr'@'localhost';
	GRANT ALL ON openemr.product_warehouse to 'openemr'@'localhost';
	GRANT ALL ON openemr.registry to 'openemr'@'localhost';
	GRANT ALL ON openemr.report_results to 'openemr'@'localhost';
	GRANT ALL ON openemr.rsa_pairs to 'openemr'@'localhost';
	GRANT ALL ON openemr.rule_action to 'openemr'@'localhost';
	GRANT ALL ON openemr.rule_action_item to 'openemr'@'localhost';
	GRANT ALL ON openemr.rule_filter to 'openemr'@'localhost';
	GRANT ALL ON openemr.rule_patient_data to 'openemr'@'localhost';
	GRANT ALL ON openemr.rule_reminder to 'openemr'@'localhost';
	GRANT ALL ON openemr.rule_target to 'openemr'@'localhost';
	GRANT ALL ON openemr.sequences to 'openemr'@'localhost';
	GRANT ALL ON openemr.standardized_tables_track to 'openemr'@'localhost';
	GRANT ALL ON openemr.supported_external_dataloads to 'openemr'@'localhost';
	GRANT ALL ON openemr.syndromic_surveillance to 'openemr'@'localhost';
	GRANT ALL ON openemr.template_users to 'openemr'@'localhost';
	GRANT ALL ON openemr.transactions to 'openemr'@'localhost';
	GRANT ALL ON openemr.user_settings to 'openemr'@'localhost';
	GRANT ALL ON openemr.users to 'openemr'@'localhost';
	GRANT ALL ON openemr.users_facility to 'openemr'@'localhost';
	GRANT ALL ON openemr.version to 'openemr'@'localhost';
	GRANT ALL ON openemr.x12_partners to 'openemr'@'localhost';